//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public class PathShadeProperties : ShadeProperties
    {
        private RelativeRectangle fillToRect;

        private PathShadeType path;

        public RelativeRectangle FillToRectangle
        {
            get { return fillToRect; }
            set { fillToRect = value; }
        }

        public PathShadeType Path
        {
            get { return path; }
            set { path = value; }
        }

        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read("path"))
            {
                Path = c.GetOptionalEnum("path", PathShadeType.Shape); //\\?? optional param
                FillToRectangle = c.ReadElementAs<RelativeRectangle>("fillToRect");
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (WriteContext c = context.Write("path"))
            {
                c.SetOptionalEnum("path", Path, PathShadeType.Shape);
                c.WriteElementAs(FillToRectangle, "fillToRect");
            }
        }
    }
}